package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.Cariries;
import com.ruoyi.system.service.ICaririesService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 承运商管理Controller
 * 
 * @author ruoyi
 * @date 2025-01-16
 */
@RestController
@RequestMapping("/cariries")
public class CaririesController extends BaseController
{
    @Autowired
    private ICaririesService caririesService;

    /**
     * 查询承运商管理列表
     */
    @RequiresPermissions("system:cariries:list")
    @GetMapping("/list")
    public TableDataInfo list(Cariries cariries)
    {
        startPage();
        List<Cariries> list = caririesService.selectCaririesList(cariries);
        return getDataTable(list);
    }

    /**
     * 导出承运商管理列表
     */
    @RequiresPermissions("system:cariries:export")
    @Log(title = "承运商管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Cariries cariries)
    {
        List<Cariries> list = caririesService.selectCaririesList(cariries);
        ExcelUtil<Cariries> util = new ExcelUtil<Cariries>(Cariries.class);
        util.exportExcel(response, list, "承运商管理数据");
    }

    /**
     * 获取承运商管理详细信息
     */
    @RequiresPermissions("system:cariries:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(caririesService.selectCaririesById(id));
    }

    /**
     * 新增承运商管理
     */
    @RequiresPermissions("system:cariries:add")
    @Log(title = "承运商管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Cariries cariries)
    {
        return toAjax(caririesService.insertCariries(cariries));
    }

    /**
     * 修改承运商管理
     */
    @RequiresPermissions("system:cariries:edit")
    @Log(title = "承运商管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Cariries cariries)
    {
        return toAjax(caririesService.updateCariries(cariries));
    }

    /**
     * 删除承运商管理
     */
    @RequiresPermissions("system:cariries:remove")
    @Log(title = "承运商管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(caririesService.deleteCaririesByIds(ids));
    }
}
